
<div style="min-height: 500px;">
<table id="sanpham" border=1 style="border-collapse: collapse;border-style: outset;border-width:1px!important ;border-spacing: 2px;">
                         
                         <tr id="one">
                            <td id="id">Id </td>
                            <td id="ten">Tên </td>
                            <td id="gia">Giá </td>
                            <td id="anh">Ảnh </td>
                            <td id="phanloai">Phân loại </td>
                            <td id="soluong">Số lượng </td>
                            <td id="chat">Chất </td>
                            <td id="mota">Mô tả </td>
                            <td>Ẩn hiện</td>
                             <td id="ghichu">Ghí chú </td>
                             <td style="width: 40px;">Khuyến mãi</td>
                            <td id="option">Tùy chọn </td>
                         </tr>
                         <?php
                          if(isset($_REQUEST[sua]) && $_REQUEST[sua]=yes){
                          $id=$_REQUEST[p];
                          $mysql->query("select* from sanpham where id='{$id}'");
                          $row1=$mysql->fetchRow();
                         ?>
                         <tr class="suatr">                
                              <form action="action.php?p=<?php echo $id;?>" method="post" enctype="multipart/form-data" id="them">
                                 <td><input class="id_c" type="text" value="<?php echo $row1[id]?>"class="required" /></td>
                                 <td><input class="sua_c" type="text" name="name" value="<?php echo $row1[name]?>"class="required" /></td>
                                 <td><input class="sua_g" type="text" name="gia"value="<?php echo $row1[price]?>"class="required" /></td>
                                 <td><input class="sua_c1" name="file" value="<?php if(isset($row[img])){echo $row[img];}?>" type="file" class="required" /></td>
                                 <td><input class="sua_c" type="text" name="category" value="<?php echo $row1[category]?>"class="required" /></td>
                                 <td><input class="sua_c" type="text" name="number_art"value="<?php echo $row1[number_art]?>"class="required" /></td>
                                 <td><input class="sua_c" type="text" name="chatlieu"value="<?php echo $row1[chatlieu]?>" class="required"/></td>
                                 <td><input class="sua_m" type="text" name="mota"value="<?php echo $row1[mota]?>"class="required" /></td>
                                 <td></td>
                                 <td><input class="sua_c" type="text" name="ghichu" value="<?php echo $row1[ghichu]?>"class="required" /></td>
                                 <td></td>
                                 <td><input type="submit" name="sua" id="sua" value="Sữa nha"/></td>
                              </form>
                              
                         </tr>
                          <?php }?>
                         <?php
                             $i=1;
                             while($row=$mysql->fetchRow()){
                             if($i%2==0){
                                $class="chan";
                             }else{
                                $class="le";
                             }
                              if($i<=5){
                                $new="new";
                             }else if($i>5){
                                $new="owl";
                             }
                         ?> 
                         <tr class="<?php echo $class?>">
                            
                            <td><?php echo $row[id]?></td>
                            <td><?php echo $row[name]?></td>
                            <td class="<?php echo $new;?>"><p><?php echo $row[price]?></p></td>
                            <td><img src="../upload/<?php echo $row[img]?>"/></td>
                            <td><?php echo $row[category]?></td>
                            <td><?php echo $row[number_art]?></td>
                            <td><?php echo $row[chatlieu]?></td>
                            <td><?php echo $row[mota]?></td>
                             <td>
                                 <?php
                                   if($row[anhien]==0){
                                    echo"<a class='an' href='action.php?p={$row[id]}&hien=sp1'>Hiện</a>";
                                   }else if($row[anhien]==1){
                                    echo"<a class='hien' href='action.php?p={$row[id]}&hien=sp2'>Ẩn</a>";
                                   }
                                 ?>
                               </td>
                            <td><?php echo $row[ghichu]?></td>
                            
                            <td>
                              <?php
                            if($row[khuyenmai]=='0'){
                             echo"<a class='nkm' href='action.php?khuyenmai=true&p={$row[id]}'>nKm</a>";
                            }else if($row[khuyenmai]=='1'){
                              echo"<a class='km' href='action.php?khuyenmai=flase&p={$row[id]}'>Km</a>";   
                            }
                            ?>
                            </td>
                            <td class="option_c">
                              <script>
                                function confirmDelete(delUrl) {
                                  if (confirm("Are you sure you want to delete")) {
                                    document.location = delUrl;
                                  }
                                }
                                </script>
                                
                                
                               <ul id="tuy_">
                                  <li><a href="index.php?p=<?php echo $row[id]?>&sua=yes$sanpham=true">Sữa</a></li>
                                  <li>
                                  <a href="javascript:confirmDelete('action.php?action=delete&p=<?php echo $row[id];?>')">Xóa</a>
                                  </li>
                               </ul>
                            </td>
                         </tr>
                         <?php $i++; }
                         ?>
                      </table>  
</div>